package com.xuecheng.content.api;

import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "教师信息管理接口",tags = "教师信息管理接口")
@RequestMapping("/courseTeacher")
public class CourseTeacherController {
    @Autowired
    private CourseTeacherService courseTeacherService;
    @GetMapping("/list/{id}")
    @ApiOperation("查询教师信息")
    public List<CourseTeacher> list(@PathVariable Long id) {
        return courseTeacherService.listCourseTeacher(id);
    }

    /**
     * 新增教师
     * @param courseTeacher
     * @return
     */
    @PostMapping
    @ApiOperation("添加教师")
    public CourseTeacher saveCourseTeacher(@RequestBody CourseTeacher courseTeacher) {
        //TODO 替换成实际的id
        Long companyId = 1232141425L;
        return courseTeacherService.createCourseTeacher(courseTeacher);
    }
    @ApiOperation("删除教师")
    @DeleteMapping("/course/{courseId}/{id}")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long id) {
        Long companyId = 1232141425L;
        courseTeacherService.deleteTeachplan(courseId,id);

    }

}
